
-- procedure to get the latest transction of a tool
-- it returns only image on or off.
IF OBJECT_ID('getLastTrans') IS NOT NULL
BEGIN
	DROP PROCEDURE getLastTrans;
END
GO
CREATE PROCEDURE getLastTrans
	@ToolId		VARCHAR(30),
	@HouseId	VARCHAR(30)
AS
BEGIN
	SELECT TOP 1 [light] FROM [transaction] WHERE houseid=@HouseId AND toolid=@ToolId ORDER BY transactionid DESC;
END
GO
